import React from "react";
import Header from "../../../components/Header";
import { bindActionCreators } from "redux";
import actions from "@/redux/actions";
import { connect } from "react-redux";

class Set extends React.Component {
  constructor() {
    super();
    this.logout = this.logout.bind(this);
  }

  logout() {
    this.props.actions.updateLogin(false);
    this.props.history.push("/my/center");
  }

  render() {
    return (
      <div className="my-set">
        <Header title="设置"></Header>
        <div className="list">
          <div
            className="item bg-fff flex jc-sb aic pl-15 pr-15 mt-10"
            style={{ height: "50px" }}
          >
            <span>密码</span>
            <img
              className="arrow"
              style={{ height: "25px" }}
              src={require("../../../assest/img/rightArrow.png")}
              alt=""
            />
          </div>
          <div
            className="item bg-fff flex jc-sb aic pl-15 pr-15 bdb"
            style={{ height: "50px", marginTop: "1px" }}
          >
            <span>手机号码</span>
            <img
              className="arrow"
              style={{ height: "25px" }}
              src={require("../../../assest/img/rightArrow.png")}
              alt=""
            />
          </div>
        </div>
        <div
          onClick={this.logout}
          className="fixed w100pc fcc blue bg-fff f18"
          style={{ bottom: 0, height: "50px" }}
        >
          退出
        </div>
      </div>
    );
  }
}

function mapStateToProps(state) {
  return {
    isLogin: state.login.isLogin
  };
}

function mapDisapatchToProps(dispatch) {
  return {
    actions: bindActionCreators(actions, dispatch)
  };
}

export default connect(mapStateToProps, mapDisapatchToProps)(Set);
